<?php
// +----------------------------------------------------------------------
// | EtrolPHP [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Author: Author: HCZ <huangchengze@qq.com> 
// +----------------------------------------------------------------------

namespace app\duty\controller\api;
use app\common\controller\Api;

/**
 * 全景态势
 * @package app\duty
 * @author <huangchengze@etrol.com>
 */
class Panorama extends Api{
	
	/**
	 * 获取物资装备列表
	 * @param array $data 搜索条件
	 */
	public function getMaterialList($data = null){
		$where = [];
		if(isset($data['typeId'])){
			$where['typeId'] = $data['typeId'];
		}
		//分页参数
		if(($limit = input('limit')) && ($page = input('page'))){
			$startLimit =  ($page-1)*$limit;
			//物资装备列表
			$info =collection(model('Equipe')->with('enterprise,store')->where($where)->limit($startLimit.','.$limit)->select())->toArray();
		}else{
			//物资装备列表
			$info =collection(model('Equipe')->with('enterprise,store')->where($where)->select())->toArray();
		}
		//总数
		$count = model('Equipe')->where($where)->count('id');
		
		if ($count >= 0){
			return json(['code'=>1,'msg'=>'物资信息','count'=>$count,'data'=>$info]);
		}
	}
}